you need to use two single quotes to enclose what will eventually be a literal...
ie ''S51'' not "S51"
the 3 quotes in the
AND CONVERT(VARCHAR(12), crcalldatetime, 110) between "' + @startdate + '" and "' + @enddate + '"
are actually (intended to be) 3 single quotes ... because you are using dynamic sql (A bad idea usually)
you need to contruct the sql string with embeded quotes around your literal strings...
when doing this you double up / escape the quote character so that the sql parser recognisez that you want to actually use a quote within the string rather than end the current string...
you probably want this
SELECT @SQL = 'SELECT ''' + @NAME + ''', CRAGENTID, count(DISTINCT L.I3_ROWID) '
+ ' FROM [' + @NAME + '_CALLLIST] as L '
+ ' WHERE CRCallResultCode like ''S51'''
+ ' AND CONVERT(CHAR(12), crcalldatetime, 110) between '''
+ @startdate + ''' and ''' + @enddate + ''''
+ ' GROUP BY CRAGENTID'