SQL Server 2005 introduces the ability to write Stored Procedures, Functions, Triggers, User Defined Types and User Defined Aggregations using any of the available .Net languages such as VB.NET or C#.
You can do this by using
SqlPipe sqlP = SqlContext.GetPipe(); function
and then sqlP.Send() method
you can read this tutorial on
http://www.sqldbatips.com/showarticle.asp?ID=22