IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TextMessage' AND COLUMN_NAME = 'Dom_ID_Marja') begin alter table TextMessage add Dom_ID_Marja int references Domain(ID) not null default -1 end ; IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TextMessage' AND COLUMN_NAME = 'Reference_ID') begin alter table TextMessage add Reference_ID bigint not null default -1 end