Use the system procedure dbo.sa_external_library_unload to unload an external library when the library is not in use. The procedure takes one optional parameter, a long varchar. The parameter specifies the name of the library to be unloaded. If you do not specify a parameter, all external libraries that are not in use are unloaded.
This example unloads an external function library.
call sa_external_library_unload('library.dll')