IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'TETKIKONAYAKTIF' AND SYSOBJECTS.name = 'TBOLUM')
ALTER TABLE dbo.TBOLUM ADD
	TETKIKONAYAKTIF bit NOT NULL CONSTRAINT DF_TBOLUM_TETKIKONAYAKTIF DEFAULT 0
GO

UPDATE TBOLUM SET TETKIKONAYAKTIF = 1 
WHERE BOLUMTURU = 2 AND TETKIKONAYAKTIF = 0 AND 
      EXISTS(SELECT CONFIGID FROM CONFIG WHERE KEYNAME = 'Tetkiklerin Tamamlanmasi Icin Onay Gerekli' AND VALUESTR = '1')
GO