title: SQL ERROR : Column already has a DEFAULT bound to it
body: <p>I have a table as below with a default value column as [IsProcessed]</p>
  <pre><code>IF NOT EXISTS (SELECT * FROM sys.objects 
                 WHERE object_id = OBJECT_ID(N'[dbo].[Kovair_JileEventHistory]') 
                   AND type in (N'U'))
  BEGIN
      CREATE TABLE [dbo].[Kovair_JileEventHistory]
      (
          [Id] [bigint] IDENTITY(1,1) NOT NULL,
          [GeneratedActionId] [char](36) NOT NULL,
          [BaseUrl] [nvarchar](255) NOT NULL,
          [ProjectName] [nvarchar](255) NOT NULL,
          [EntityName] [varchar](255) NOT NULL,
          [EntityId] [varchar](255) NOT NULL,
          [RelatedEntityName] [varchar](255) NOT NULL,
          [RelatedEntityId] [varchar](255) NOT NULL,
          [ActionName] [varchar](255) NOT NULL,
          [LoopbackEventName] [varchar](255) NOT NULL,
          [LastUpdatedOnGMT] [varchar](50) NOT NULL,
          [LastUpdatedBy] [nvarchar](255) NOT NULL,
          [IsProcessed] [char](1) NULL,
  
          PRIMARY KEY CLUSTERED ([Id] ASC)
                  WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
                        IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, 
                        ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY]
  END
  
  IF NOT EXISTS (SELECT * FROM sys.objects 
                 WHERE object_id = OBJECT_ID(N'[dbo].[DF__Kovair_Ji__IsPro__5224328E]') 
                   AND type = 'D')
  BEGIN
      ALTER TABLE [dbo].[Kovair_JileEventHistory] 
          ADD DEFAULT ('N') FOR [IsProcessed]
  END
  </code></pre>
  <p>When I am executing this lines in a different system if I execute it once its working fine but on the second time when I am executing it its giving me an error as below.</p>
  <blockquote>
  <p>Msg 1781, Level 16, State 1, Line 26<br />
  Column already has a DEFAULT bound to it.</p>
  <p>Msg 1750, Level 16, State 0, Line 26<br />
  Could not create constraint. See previous errors.</p>
  </blockquote>
  <p>But when ever I am doing the same in my system from where I have generated this script I am able to execute it multiple time without any error.</p>
  <p>I think</p>
  <pre><code>IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF__Kovair_Ji__IsPro__5224328E]') AND type = 'D')
  BEGIN
  ALTER TABLE [dbo].[Kovair_JileEventHistory] ADD  DEFAULT ('N') FOR [IsProcessed]
  END
  </code></pre>
  <p>in this lines the part where OBJECT_ID(N'[dbo].[DF__Kovair_Ji__IsPro__5224328E]') is system specific.</p>
  <p>Is there any way to solve this issue?</p>