Returns 0 if the specified string is not a valid identifier or a number other than 0 if the string is a valid identifier, and can be up to 255 bytes in length.
valid_name(character_expression[, maximum_length])
create procedure chkname @name varchar(30) as if valid_name(@name) = 0 print "name not valid"
valid_name, a system function, returns 0 if the character_expression is not a valid identifier (illegal characters, more than 30 bytes long, or a reserved word), or a number other than 0 if it is a valid identifier.
The SAP ASE server identifiers can be a maximum of 16384 bytes in length, whether single-byte or multibyte characters are used. The first character of an identifier must be either an alphabetic character, as defined in the current character set, or the underscore (_ ) character. Temporary table names, which begin with the pound sign (#), and local variable names, which begin with the at sign (@), are exceptions to this rule. valid_name returns 0 for identifiers that begin with the pound sign (#) and the at sign (@).
Transact-SQL Users Guide
sp_checkreswords in Reference Manual: Procedures
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute valid_name.