Check if a table or column already exits in Transact SQL.
--
-- Check if table or column already exits
--
DECLARE @count as int;
-- Check if table with a given column already exists
-- using `INFORMATION_SCHEMA.COLUMNS`
SELECT @count = count(table_name)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'INSERT_YOUR_TABLENAME_HERE'
AND column_name = 'INSERT_YOUR_COLUMN_NAME_HERE';
-- if the table wasn't found do ...
IF ISNULL(@count, 0) = 0
BEGIN
-- INSERT YOUR SCRIPT HERE
END