I loath SQL. Here's another example of why:
This wont execute from Query Analyzer
INSERT INTO [dbo].[TB_PROPERTY]([KEY],[STRING_VAL],[SYSOWNED],[msrepl_tran_version])
VALUES ('KEY_NAME', 'IF EXISTS (SELECT * FROM sysobjects
WHERE id = OBJECT_ID(''%STORED_PROCEDURE_NAME%'') AND OBJECTPROPERTY(id, ''IsProcedure'') = 1)
DROP PROCEDURE [dbo].[%STORED_PROCEDURE_NAME%]
GO', 1, '2A3AD395-E4A4-4875-BF77-BF64F00A0A52' )
GO
It seems that QA detects the GO statement inside the quoted string and refuses to continue. A 'GO' string that begins on a new line is always interpreted as a keyword even if inside a string! Doh!