The variable @hr will store the return value from the system
stored procedure call to ensure that the call was successful.
If the value is other than zero it means that an error occurred.
sp_oacreate will create an instance of the object previously created
with VB6 and properly registered as an ActiveX control. VB6 will
do that automatically when compiling the code. The next line of
code uses sp_oamethod which will call a method of the ActiveX
control. In this example, there are only two methods, encrypt
and decrypt but there could be properties too. Finally, sp_OADestroy
will destroy the instance we used before.

The system stored procedures used are the following:

sp_oacreate-Creates an instance of the OLE object.
sp_OAMethod-Calls a method of an OLE object.
sp_OADestroy-Destroys an instance of an OLE object.

Other useful ones:

sp_OAGetProperty-Gets a property value of an OLE object.
sp_OASetProperty-Sets a property of an OLE object.
sp_OAGetErrorInfo-Returns an error code from the latest OLE Automation
operation.

RC4 Encryption

Stored Procedures

Sp_RC4- Encrypts any data type input to a varchar data type.
Used to encrypt character data, such as text.

Sp_RC4Bin- Encrypts any data type input to a varbinary data
type. Used to encrypt binary data, such as numbers or pictures.

User Defined Functions

XRC4- Encrypts any data type input to a varchar data type.
Used to encrypt character data, such as text.

XRC4Bin- Encrypts any data type input to a varbinary data type.
Used to encrypt binary data, such as numbers or pictures.

Rijndael Encryption

Stored Procedures

Sp_EncRijndael- Encrypts any data type input to a varchar data
type. Used to encrypt character data, such as text.

Sp_DecRijndael- Decrypts any data type input to a varchar data
type.

Sp_EncRijndaelBin- Encrypts any data type input to a varbinary
data type. Used to encrypt binary data, such as pictures.