IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'SanadRefrenceID' AND COLUMN_NAME = 'ProductDetail_ID') begin alter table SanadRefrenceID add ProductDetail_ID int references ProductDetail(ID) null end ; IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'SanadRefrenceID' AND COLUMN_NAME = 'ConvertGood_ID') begin alter table SanadRefrenceID add ConvertGood_ID int references ConvertGood(ID) null end ; IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'SanadRefrenceID' AND COLUMN_NAME = 'StoreDocumentAccount_ID') begin alter table SanadRefrenceID add StoreDocumentAccount_ID int references StoreDocument(ID) null end ; IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'SanadRefrenceID' AND COLUMN_NAME = 'CommercialStore_ID') begin alter table SanadRefrenceID add CommercialStore_ID int references CommercialStore(ID) null end ; IF not EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'SanadRefrenceID' AND COLUMN_NAME = 'TafsiliRemind_ID') begin alter table dbo.SanadRefrenceID add TafsiliRemind_ID int references dbo.TafsiliRemind(ID) null end