You can use Information_schema views:
If Not Exists (Select Column_Name
From INFORMATION_SCHEMA.COLUMNS
Where Table_Name = 'YourTable'
And Column_Name = 'YourColumn')
begin
end
In addition, you can restrict the offer whereby including a database and / or schema in it.
If Not Exists (Select Column_Name
From INFORMATION_SCHEMA.COLUMNS
Where Table_Name = 'YourTable'
And Column_Name = 'YourColumn'
And Table_Catalog = 'YourDatabaseName'
And Table_Schema = 'YourSchemaName')
begin
end
source
share