I just tried to create the function and got all the errors below.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 24
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 25
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 31
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 32
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 36
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 37
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 38
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 39
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 40
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 41
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 42
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 44
Incorrect syntax near '?'.
Msg 137, Level 15, State 1, Procedure usp_lsping, Line 44
Must declare the scalar variable "@Clr".
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 46
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 47
Incorrect syntax near '?'.
Msg 137, Level 15, State 1, Procedure usp_lsping, Line 47
Must declare the scalar variable "@msg".
Msg 137, Level 15, State 2, Procedure usp_lsping, Line 48
Must declare the scalar variable "@msg".
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 50
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 52
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 55
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 58
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 59
Incorrect syntax near '?'.
Msg 137, Level 15, State 2, Procedure usp_lsping, Line 61
Must declare the scalar variable "@msg".
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 63
Incorrect syntax near '?'.
Msg 137, Level 15, State 2, Procedure usp_lsping, Line 64
Must declare the scalar variable "@msg".
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 66
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 72
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 75
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Procedure usp_lsping, Line 91
Incorrect syntax near 'off'.