How to optimize SQL Server data access programs