if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_template_templateType]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[template] DROP CONSTRAINT FK_template_templateType
GO

IF EXISTS (SELECT name FROM syscolumns WHERE (id = OBJECT_ID(N'template')) AND (name = 'typeId'))  ALTER TABLE template DROP COLUMN typeId
GO
alter Table template Add typeId int 
GO



