Been doing some research on this and found that in MS SQL 2008 and higher you can use Spatial Data. Here is an example of a query that takes a lat and long as parameters and gets all the locations from a custom table and orders them by closest to furthest away.
SELECT *, GEOGRAPHY::Point(Latitude, Longitude, 4326).STDistance('POINT(' + CAST(@CenterLongitude AS NVARCHAR(100)) + ' ' + CAST(@CenterLatitude AS NVARCHAR(100)) + ')')/1609.344 AS ProxDistance
FROM Custom_Location
ORDER BY ProxDistance
The ProxDistance field is converted to miles (<value>/1609.344) so if you don't want miles, remove that.