IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'MIKROORGANIZMA' AND SYSOBJECTS.name = 'HTETKIKDETAY')
ALTER TABLE dbo.HTETKIKDETAY ADD [MIKROORGANIZMA] [bit] NULL 
GO

IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'MIKROORGANIZMAID' AND SYSOBJECTS.name = 'HTETKIKDETAY')
ALTER TABLE dbo.HTETKIKDETAY ADD [MIKROORGANIZMAID] [int] NULL
GO

IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'PANIKUYARI' AND SYSOBJECTS.name = 'HTETKIKDETAY')
ALTER TABLE dbo.HTETKIKDETAY ADD [PANIKUYARI] [bit] NULL 
GO

IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'PANIKUYARIGORULDU' AND SYSOBJECTS.name = 'HTETKIKDETAY')
ALTER TABLE dbo.HTETKIKDETAY ADD [PANIKUYARIGORULDU] [bit] NULL 
GO

/*WHILE EXISTS(SELECT TOP 1 * FROM HTETKIKDETAY WHERE MIKROORGANIZMA IS NULL OR PANIKUYARI IS NULL OR PANIKUYARIGORULDU IS NULL)
BEGIN
UPDATE TOP (3000) HTETKIKDETAY 
SET MIKROORGANIZMA = 0, PANIKUYARI = 0, PANIKUYARIGORULDU = 0 
WHERE MIKROORGANIZMA IS NULL OR PANIKUYARI IS NULL OR PANIKUYARIGORULDU IS NULL
END*/

IF NOT EXISTS (
select * from syscolumns inner join 
     sysobjects on syscolumns.id = sysobjects.id inner join
     sysconstraints on constid = syscolumns.cdefault 
where sysobjects.name = 'HTETKIKDETAY' and syscolumns.name='MIKROORGANIZMA')
ALTER TABLE HTETKIKDETAY ADD  CONSTRAINT [DF_HTETKIKDETAY_MIKROORGANIZMA]  DEFAULT ((0)) FOR MIKROORGANIZMA 
GO

IF NOT EXISTS (
select * from syscolumns inner join 
     sysobjects on syscolumns.id = sysobjects.id inner join
     sysconstraints on constid = syscolumns.cdefault 
where sysobjects.name = 'HTETKIKDETAY' and syscolumns.name='PANIKUYARI')
ALTER TABLE HTETKIKDETAY ADD  CONSTRAINT [DF_HTETKIKDETAY_PANIKUYARI]  DEFAULT ((0)) FOR PANIKUYARI 
GO

IF NOT EXISTS (
select * from syscolumns inner join 
     sysobjects on syscolumns.id = sysobjects.id inner join
     sysconstraints on constid = syscolumns.cdefault 
where sysobjects.name = 'HTETKIKDETAY' and syscolumns.name='PANIKUYARIGORULDU')
ALTER TABLE HTETKIKDETAY ADD  CONSTRAINT [DF_HTETKIKDETAY_PANIKUYARIGORULDU]  DEFAULT ((0)) FOR PANIKUYARIGORULDU 
GO