Once you have created an ESP function and linked it into a DLL, register it as an ESP in a database, which lets users execute the function as an ESP.
The Transact-SQL create procedure command, or,
sp_addextendedproc.