This code does not work, returning the error:
BEGIN CREATE VIEW [dbo].[dummy] AS SELECT 1 AS Dummy END GO` Incorrect syntax near the keyword \'VIEW\'. >
It's because CREATE VIEW must be the first statement in a batch as described in this MSDN reference.
Instead, you could do: e.g.
..... BEGIN EXECUTE('CREATE VIEW [dbo].[dummy] AS SELECT 1 AS Dummy') END