This is most likely caused by not using a high enough quality cheese. Cheap shredded cheeses have preservatives and anti-caking agents like cornstarch or potato starch.  These can cause the sauce to have a lumpy texture instead of creamy. Shred your own from blocks for the most consistent results.