Melt the butter in a medium saucepan over medium heat.
Whisk in the flour to create a roux, cooking for about 1 minute.
Gradually add the milk, whisking constantly to prevent lumps.
Continue to cook until the mixture thickens, about 4-5 minutes.
Lower the heat and stir in the shredded cheese until melted.
Mix in garlic powder, onion powder, salt, and pepper.
Taste and adjust seasoning, adding cayenne for heat if desired.
Remove from heat and let cool slightly before serving.
If the sauce thickens too much, add a splash of milk.
Serve warm over your favorite dishes.