title: Generate Script With If EXIST DROP But Do Not Include If Not Exists In CREATE In SQL Server
body: <p>I want to generate the script using <strong><code>Tasks | Generate Scripts</code></strong> with <strong><code>IF Exist Drop Stored Procedure</code></strong>.</p>
  
  <p>But I don't want to include <strong><code>IF NOT EXISTS - Create Stored Procedure</code></strong> while generating Script then what should I do?</p>
  
  <p><strong>Current</strong></p>
  
  <pre><code>IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SPNAME]') AND type in (N'P', N'PC'))
  DROP PROCEDURE [dbo].[SPNAME]
  GO
  
  IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SPNAME]') AND type in (N'P', N'PC'))
  BEGIN
  EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[SPNAME] AS' 
  END
  GO
  </code></pre>
  
  <p><strong>Required</strong></p>
  
  <pre><code>IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SPNAME]') AND type in (N'P', N'PC'))
  DROP PROCEDURE [dbo].[SPNAME]
  GO
  
  CREATE PROCEDURE [dbo].[SPNAME] AS 
  </code></pre>
  
  <p><em>Can anyone please help me!</em></p>