Creating a view dynamically via a variable - SQL SERVER : I am attempting to create a SQL Server view based upon a query dynamically using a variable. 

I have written and tested the query and can confirm it works with the results, I have attached a link to Imgur to view the screenshots as I am unable to post the full query due to reasons. 

Creating the view however, I am receiving a few errors and can't seem to work them out! I have checked over the query multiple times and re-structured my code in creating the view.

    declare @MarketingCampaignID int,@viewQuery nvarchar(max)
    set @MarketingCampaignID=246159
    if exists(select * from sys.views where name='vwCampaign_' + cast(@MarketingCampaignID as nvarchar(255)) + '_FlatValueTable')
    begin
    set @viewQuery = 'drop view XMPieTracking.vwCampaign_' + cast(@MarketingCampaignID as nvarchar(255)) + '_FlatValueTable'
    exec (@viewQuery)
    end
    set @viewQuery = N'Create View XMPieTracking.vwCampaign_' + cast(@MarketingCampaignID as nvarchar(255)) + '_FlatValueTable'
    set @viewQuery = @viewQuery + N'SELECT * FROM (...)
    exec( @viewQuery)

- See images. https://imgur.com/a/qIhN339