How to use server-side sql queries

I am at an em-pass. I want to write an application where I will query an external database. My problem is this. I want to reach this database from the outside of my internal network via the intern. I know how to do client-side queries using dbcommand and so forth. How do I do these queries on the server-side? I want to be able to execute stored procedures developed on a MS sql server. Can someone direct me to the right documentation, tutorials or examples on this site or on the internet?