I can\'t figure out why (or maybe you just can\'t do this) I get the out of scope error
Must declare the scalar variable \"@CompanyGroupSites_Master.
This is a long standing parser issue. You need to get rid of the table prefix or wrap it in square brackets.
i.e.
delete from @CompanyGroupSites_Master
where CompanyGroupID = @CompanyGroupID
or
delete from @CompanyGroupSites_Master
where [@CompanyGroupSites_Master].CompanyGroupID = @CompanyGroupID
Not
delete from @CompanyGroupSites_Master
where @CompanyGroupSites_Master.CompanyGroupID = @CompanyGroupID