You can write the SP is as below :
CREATE PROCEDURE [dbo].[GetDepartmentName]
@ID int,
@Name nvarchar(50) OUTPUT
AS
SELECT @Name = Name FROM Department
WHERE DepartmentID = @ID
For more info :
MSDN
If you're using EF then check below mentioned articles.
using (MyEntities myContext = new MyEntities ())
{
System.Data.Objects.ObjectParameter output = new System.Data.Objects.ObjectParameter("OutputParameterName", typeof(int));
myContext.GetCustomerCount(output);
Console.WriteLine(output.Value);
}
More info :
Output parameter with Entity Framework
Another one :
How to Retrieve Stored Procedure Output Parameters in Entity Framework