What is the difference between stored procedure and user-defined function?

Both can be custom-defined as part of any application, but functions are designed to send their output to a query or T-SQL statement. Stored procedures are designed to return outputs to the application, while a user-defined function returns table variables and cannot change the server environment or operating system environment.
For More Information Please Refer:

You May Also Like to Read: