• The script works fine for SQL2012 . But does not for SQL2008 and 2008R2.
    Error:

    Msg 102, Level 15, State 1, Procedure proc_check_linked_servers, Line 37 [Batch Start Line 0]

    Incorrect syntax near '?'.

    Msg 102, Level 15, State 1, Procedure proc_check_linked_servers, Line 39 [Batch Start Line 0]

    Incorrect syntax near '?'.

    Msg 102, Level 15, State 1, Procedure proc_check_linked_servers, Line 40 [Batch Start Line 0]

    Incorrect syntax near '?'.

    Msg 102, Level 15, State 1, Procedure proc_check_linked_servers, Line 42 [Batch Start Line 0]

    Incorrect syntax near '?'.

    Msg 102, Level 15, State 1, Procedure proc_check_linked_servers, Line 43 [Batch Start Line 0]

    Incorrect syntax near '?'.

    Msg 137, Level 15, State 2, Procedure proc_check_linked_servers, Line 43 [Batch Start Line 0]

    Must declare the scalar variable "@emailSubject".

    Msg 102, Level 15, State 1, Procedure proc_check_linked_servers, Line 46 [Batch Start Line 0]

    Incorrect syntax near '?'.

    Msg 137, Level 15, State 2, Procedure proc_check_linked_servers, Line 53 [Batch Start Line 0]

    Must declare the scalar variable "@emailSubject".

    Msg 319, Level 15, State 1, Procedure proc_check_linked_servers, Line 53 [Batch Start Line 0]

    Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.