Start by learning some basic SQL. You can do this by reading some basic articles in SQL Server Books On Line or on may web sites (SQLTeam.com, SQLServerCentral, SSWUG.org, etc, etc) then creating simple queries in your database or in one of the sample databases (download from microsoft.com) and looking at the SQL view.
Then to create a stored proc, if your using SQL Server 2005, open the Programmability folder, right-click on Stored Procedures and click New Stored Procedure. It will start by creating a stored proc from a template and you can go from there.
I found that it was best to look at a lot of samples, execute them and make a few changes to them before embarking on creating my own stored procs.
answered Oct 13, 2009 at 03:37 AM
Alternatively, if you want to code a procedure in T-SQL, look up CREATE PROCEDURE in Books Online (SQL's help file).
answered Oct 13, 2009 at 05:12 AM
I'll point you to Aaron Bertrand's blog entry on best practices on stored procs. I think it'll be a good read for you.
answered Oct 13, 2009 at 03:04 PM