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

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

UPDATE TANKET SET SUBEID=(SELECT TOP 1 SUBEID FROM SUBELER)
GO
UPDATE ANKETKATILIM SET SUBEID=(SELECT TOP 1 SUBEID FROM SUBELER)
GO