IF EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
              WHERE SYSCOLUMNS.NAME = 'GELDIGIKURUMPATIENTID' AND SYSOBJECTS.name = 'HESAPISL')
ALTER TABLE HESAPISL DROP COLUMN GELDIGIKURUMPATIENTID
GO

IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
              WHERE SYSCOLUMNS.NAME = 'GELDIGIKURUMPATIENTID' AND SYSOBJECTS.name = 'HESAPISL')
ALTER TABLE HESAPISL ADD GELDIGIKURUMPATIENTID integer
GO

IF EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
              WHERE SYSCOLUMNS.NAME = 'GELDIGIKURUMACCESSIONNO' AND SYSOBJECTS.name = 'HESAPISL')
ALTER TABLE HESAPISL DROP COLUMN GELDIGIKURUMACCESSIONNO
GO

IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
              WHERE SYSCOLUMNS.NAME = 'GELDIGIKURUMACCESSIONNO' AND SYSOBJECTS.name = 'HESAPISL')
ALTER TABLE HESAPISL ADD GELDIGIKURUMACCESSIONNO integer
GO

IF EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
              WHERE SYSCOLUMNS.NAME = 'GELDIGIKURUMKODU' AND SYSOBJECTS.name = 'HESAPISL')
ALTER TABLE HESAPISL DROP COLUMN GELDIGIKURUMKODU
GO
IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
              WHERE SYSCOLUMNS.NAME = 'GELDIGIKURUMKODU' AND SYSOBJECTS.name = 'HESAPISL')
ALTER TABLE HESAPISL ADD GELDIGIKURUMKODU integer
GO
