In a large saucepan, combine the potatoes, water, carrot, corn, and onion. Bring to a boil. Reduce heat; cover and cook until tender, 10-15 minutes.
Meanwhile, in another saucepan, melt butter. Stir in flour until smooth. Gradually add the milk, salt, and pepper. Bring to a boil; cook and stir until thickened, about 2 minutes.
Stir in cheese until melted. Stir into the undrained potato mixture. Add ham (and cayenne pepper if adding). Season to taste with salt and pepper.