title: drop and create SQL Server procedure
body: <p>I'm trying to drop and create a procedure in a single script. I tried this:</p>
  
  <pre><code>IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'Foo')
    DROP PROCEDURE Foo
    GO
  
  CREATE PROCEDURE dbo.Foo
  -- procedure body here
  </code></pre>
  
  <p>But I get an error:</p>
  
  <blockquote>
    <p>Incorrect syntax near 'GO'.</p>
  </blockquote>
  
  <p>If I remove <code>GO</code>, I get an error:</p>
  
  <blockquote>
    <p>'CREATE/ALTER PROCEDURE' must be the first statement in a query batch</p>
  </blockquote>
  
  <h2>Update</h2>
  
  <p>These scripts are being executed by a Java build tool (Maven)</p>