I know I can index a column in a table with the command:
CREATE UNIQUE INDEX index_name
ON table_name (column_name)
However, I have a database of 250 schemas with 10 tables each. How can I, for each table, check if a column exists, and then create an index for it (if it does exist)?
I am using SQL Server 2012.