IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'BULTESPITYERKODU' AND SYSOBJECTS.name = 'HMUAYENE')
ALTER TABLE dbo.HMUAYENE ADD
	BULTESPITYERKODU int NULL,
	BULBELIRTIBASTRH datetime NULL,
	BULVAKABAGLANTI smallint NULL,
	BULKTANIKRITERKODU int NULL,
	BULMAJORBOLGEKODU int NULL,
	BULILACDIRENCI smallint NULL,
	BULIZONIDIRENCI smallint NULL,
	BULBELIRTIBASYERKODU int NULL,
	TEDAVIOYKUKODU int NULL
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 = 'HMUAYENE' and syscolumns.name='BULVAKABAGLANTI')
ALTER TABLE dbo.HMUAYENE ADD CONSTRAINT
	DF_HMUAYENE_BULVAKABAGLANTI DEFAULT 1 FOR BULVAKABAGLANTI
