dpratt71 said:
It is a bit small, but the first couple lines appears to be:

DB_ID(N'IntranetApps')
GO

What is this code supposed to be doing? My first guess was that you were trying to switch the connection's current database to "IntranetApps", which would look like this:

USE IntranetApps
GO

But the rest of the code doesn't require that. Remove it?
Hmm...Formatting is not what I expected (based on the preview), but hopefully you get the idea.