I'm trying to add a new column to a SQL Server table, and I want to know if it already exists or not. I have tried something like this:
IF EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'minhaTabela'
AND COLUMN_NAME = 'minhaColuna')
But it always resolves as false.
How can I tell if a column already exists in a SQL Server table?