The keyword GO
separates batches in a single script. The error says that a CREATE PROCEDURE
must be the "only" statement in a batch so it stands to reason you're missing a GO
above a CREATE PROCEDURE
somewhere.
Now look at your script, its separated into 4 broad areas
- create a table
- insert some data (and select it out again)
- create proc 1
- create proc 2
Its clear that you're missing a go
between 2. and 3.