Call a SQL Stored Procedure from a user creation template?

Call a SQL Stored Procedure from a user creation template?

I would like to call a SQL stored procedure at the end of my user creation based on if a particular field has an entry.

It would go something like this
Add custom field called "TargetUser" in template
Add custom field called "SourceUser" in template

I would then like to write a VBS or powershell script that connects to my sql database to run a stored procedure with those two fields used as parameters for the stored proc.
If the target user and source user fields are blank, i don't want that script to run (it would enter null values into the database which would cause issues)

Additionally, I will want to do something similar in my user modification template that I use for terminations.

Is this possible? Can someone give me any pointers on how to get this done?

                New to ADSelfService Plus?