DECLARE @Id Int                               
SELECT @Id = Id From sysobjects Where Name = 'AnbarId'
IF NOT Exists(SELECT * FROM syscolumns WHERE id = @Id and Name = 'NatureWarehouse')
  ALTER TABLE dbo.AnbarId Add NatureWarehouse TINYINT DEFAULT(0)
ELSE
BEGIN 
  DECLARE @NatureWarehouse VARCHAR(MAX)= (SELECT Name from dbo.sysobjects where Name LIKE 'DF__AnbarId__Nature%')
  IF ISNULL(@NatureWarehouse,'') <> ''
  BEGIN
    EXEC('ALTER TABLE [dbo].[Anbarid] DROP CONSTRAINT ' + @NatureWarehouse)
    ALTER TABLE Anbarid ALTER COLUMN NatureWarehouse TINYINT 
  End
END 

SELECT @Id = Id From sysobjects Where Name = 'AnbarId'
IF NOT Exists(SELECT * FROM syscolumns WHERE id = @Id and Name = 'NatureWarehouseGoods')
  ALTER TABLE dbo.AnbarId Add NatureWarehouseGoods TINYINT DEFAULT(0)


