Snap Point to SQL Server Spatial geometry using TSQL

This function uses the SQL Server Spatial ShortestLineTo function to compute a point on the boundary of the supplied geometry nearest to the supplied point. If the snap distance is < the user supplied @p_snap_within distance, the computed point is returned. However, if the distance is > the user supplied @p_snap_within distance the original point is returned.