With Python, you could do something like:
def add_column_to_table(c, table_name, column_name, column_type):
for row in c.execute('PRAGMA table_info({})'.format(table_name)):
if row[1] == column_name:
# print('column {} already exists in {}'.format(column_name, table_name))
break
else:
# print('add column {} to {}'.format(column_name, table_name))
c.execute('ALTER TABLE {} ADD COLUMN {} {}'.format(table_name, column_name, column_type))
c = db.cursor()
add_column_to_table(c, 'mytable', 'newcolumn', 'INTEGER')