I'm trying to achieve what the code below suggests, but I'm getting the error Incorrect syntax near the keyword 'view'
on both the create and alter lines.
IF Object_ID('TestView') IS NULL
BEGIN
create view TestView
as
. . .
END
ELSE
BEGIN
ALTER view TestView
as
. . .
END