How can you raise custom errors from stored procedure?

The RAISERROR statement is used to produce an ad hoc error message or to retrieve a custom
message that is stored in the sysmessages table. You can use this statement with the error
handling code presented in the previous section to implement custom error messages in your
applications.RAISERROR ({msg_id |msg_str }{,severity ,state }
[ ,argument [ ,,...n ] ] ))
[ WITH option [ ,,...n ] ]
A description of the components of the statement follows.
msg_id:-The ID for an error message, which is stored in the error column in sysmessages.
msg_str:- A custom message that is not contained in sysmessages.
Severity: - The severity level associated with the error. The valid values are 0–25. Severity levels
0–18 can be used by any user, but 19–25 are only available to members of the fixed-server role
sysadmin. When levels 19–25 are used, the WITH LOG option is required.