I am using sql server 2008 R2. More specifically, Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft Corporation Stan
Certain statements like CREATE TRIGGER needs to be the first in a batch (as in, group of statements separated by GO ).
https://msdn.microsoft.com/en-us/library/ms175502.aspx
Alternatively you could do this
IF NOT EXISTS ( SELECT *
FROM sys.objects
WHERE type = 'TR'
AND name = 'Insert_WithdrawalCodes' )
BEGIN
EXEC ('CREATE TRIGGER Insert_WithdrawalCodes ON ...');
END;