SQL Statement used by LINQ

LINQ-to-SQL

To send it to the Console.

using (NorthwindDataContext context = new NorthwindDataContext())
{          
    context.Log = Console.Out;

    Customer customer = context.Customers.Single<Customer>
                       (c => c.CustomerID.Equals("ALFKI"));
}

To send it to the debugger output window. (DebuggerWriter is a wrapper around System.Diagnostics.Debugger.
using (NorthwindDataContext context = new NorthwindDataContext())
{          
    context.Log = new DebuggerWriter();

    Customer customer = context.Customers.Single<Customer>
                        (c => c.CustomerID.Equals("ALFKI"));
}

Entity Framework 4.0

IQueryable<Product> q = from o in . . .

string sql = ((ObjectQuery<Product>)q).ToTraceString();

Consider adding the following to the same namespace as your Entity Model. It will add a DebugSql extension method to every IQueryable in your code, and will output the underlying SQL statement.

public static class Extender
{
    public static void DebugSql(this IQueryable q)
    {
        var o = q as ObjectQuery;
        if (o == null) return;
        Debug.Print("=".PadLeft(100, '='));
        Debug.Print(o.ToTraceString());
    }
}

Entity Framework 4.5

IQueryable<Product> q = from o in . . .

string sql = q.ToString();