IF EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'DEGER' AND SYSOBJECTS.name = 'HTEDAVITABELAHIZMETKULLANIM') AND
   NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'DEGER_' AND SYSOBJECTS.name = 'HTEDAVITABELAHIZMETKULLANIM')
	ALTER TABLE HTEDAVITABELAHIZMETKULLANIM
		ADD DEGER_ nvarchar(5) null
GO

IF EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'DEGER' AND SYSOBJECTS.name = 'HTEDAVITABELAHIZMETKULLANIM') AND
   EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
               WHERE SYSCOLUMNS.NAME = 'DEGER_' AND SYSOBJECTS.name = 'HTEDAVITABELAHIZMETKULLANIM')               
BEGIN               
	UPDATE HTEDAVITABELAHIZMETKULLANIM SET DEGER_ = CONVERT(nvarchar,CAST(DEGER as float)) 
		
	ALTER TABLE HTEDAVITABELAHIZMETKULLANIM
		DROP COLUMN DEGER 
	
	EXEC sp_RENAME 'HTEDAVITABELAHIZMETKULLANIM.DEGER_' , 'DEGER', 'COLUMN'
END
GO