The error message "'CREATE TRIGGER' must be the first statement in a query batch." usually occurs when a preceding group (batch) of statements does not have a terminating GO
So, I would suggest adding add a GO to the end of the preceding batch's statements.