IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'StoreDocumentAccount' AND COLUMN_NAME = 'SDA_ID') begin alter table StoreDocumentAccount add SDA_ID int references StoreDocumentAccount(ID) null end ; IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'StoreDocumentAccount' AND COLUMN_NAME = 'Pro_ID_Anbar') begin alter table StoreDocumentAccount add Pro_ID_Anbar int references OtherProperties(ID) not null end ; IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'StoreDocumentAccount' AND COLUMN_NAME = 'Dom_ID_Status') begin alter table StoreDocumentAccount add Dom_ID_Status int references Domain(ID) not null default -1 end ; IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'StoreDocumentAccount' AND COLUMN_NAME = 'Mat_ID') begin alter table StoreDocumentAccount add Mat_ID bigint references Matter(ID) not null default -1 end