A gritty or grainy texture can occur when the proteins in the sauce separate from the water and bind together. This can happen if your sauce is too hot when you add the cheese. Adding salt or anything acidic (such as lemon juice or powder) can also cause the sauce to curdle.