title: Incorrect syntax near the keyword 'PROCEDURE'
body: <p>Execute following statement in the SQL Server</p>
  
  <pre><code>IF  NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_CandidateRegistration]') AND type in (N'P', N'PC'))
  BEGIN
  CREATE PROCEDURE [dbo].[SP_CandidateRegistration]
      (
              @UserName VARCHAR(50),      
              @Password VARCHAR(50),
              @EmailID VARCHAR(50),
              @TestId int,
              @IsActiveUser INTEGER,      
              @USER_ID INTEGER OUTPUT
      )
      AS
      DECLARE @UserName VARCHAR(50)
      DECLARE @Password VARCHAR(50)
      DECLARE @EmailID VARCHAR(50)
      DECLARE @TestId int
      DECLARE @IsActiveUser INTEGER       
      DECLARE @USER_ID INTEGER 
  
      INSERT INTO [dbo].[IER_CandidateRegistration](User_Name, Password, EmailId, Test_Id, is_active )
      VALUES (@UserName, @Password, @EmailID,@TestId, @IsActiveUser) 
      select @USER_ID=@@identity
      RETURN
  END
  GO
  </code></pre>
  
  <p>Error after executing in SQL Server 2008 </p>
  
  <blockquote>
    <p>Msg 156, Level 15, State 1, Line 3<br>
    Incorrect syntax near the keyword 'PROCEDURE'.</p>
  </blockquote>