To write a .NET stored procedure (SP), user-defined function (UDF), or trigger, follow these steps after creating your solution and/or projects from the previous topic:
Right-click on your project (created in Writing .NET SP, UDF, and Triggers) or in any folder under your project in Solution Explorer and choose Add/New Item.
When the dialog appears, choose Visual C# Items > c-tree and choose the appropriate item.
You may consider customizing the name of the .cs file that will be created. This name is not in any way associated with your stored procedure name.
When done, click Add.
A new dialog appears. Fill in the fields:
Specify your stored procedure name.
Adjust the namespace if you require or prefer a customized project. This namespace does affect execution or definition of your stored procedure; however, your choice may help organize your work.
Set the procedure owner, parameters, and result set.
Click OK.
A new source file is created. The class you implement is already prepared and you implement the ExecuteSP method with your application logic, as described later.