IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'SN' AND SYSOBJECTS.name = 'STOKMIADBAKIYE')
ALTER TABLE dbo.STOKMIADBAKIYE ADD
	SN nvarchar(50) NULL
go

IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'GTIN' AND SYSOBJECTS.name = 'STOKMIADBAKIYE')
ALTER TABLE dbo.STOKMIADBAKIYE ADD
	GTIN nvarchar(50) NULL
go

IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'XD' AND SYSOBJECTS.name = 'STOKMIADBAKIYE')
ALTER TABLE dbo.STOKMIADBAKIYE ADD
	XD datetime NULL
go

IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'BN' AND SYSOBJECTS.name = 'STOKMIADBAKIYE')
ALTER TABLE dbo.STOKMIADBAKIYE ADD
	BN nvarchar(50) NULL
go


SELECT TOP 5 * FROM HESAPISL ORDER BY HESAPISLID DESC