You need to wrap it into a classmethod which is exposed as a stored procedure as in the example below:

Class DC.Utils [ Abstract ]
{

ClassMethod AESBCEncrypt(
pPlainText As %String,
pKey As %String) As %String [ SqlProc ]
{

return $system.Encryption.AESCBCEncrypt(pPlainText, pKey)
}

}

 Once you have done this, you can use something like:

update sample.person (Name) values (DC.Utils_AESBCEncrypt(name,'key'))

There is PERFMON and the Line-By-Line Monitor which you can use to analyze your routines. With PERFMON you can identify the most busy and expensive ROUTINES and you can then analyze a specific routine in detail.

Here are the links to the docs:

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

Hope this helps.

-Michael