Неправильный синтаксис около "%1". Если имелось в виду обобщенное табличное выражение, необходимо явно завершить предыдущую инструкцию точкой с запятой.
Click to search this error in Google
English version
Incorrect syntax near '%1'. If this is intended to be a common table expression, you need to explicitly terminate the previous statement with a semi-colon.