Preheat the oven broiler, or have a stovetop-to-oven-safe skillet ready.
Drain the corn thoroughly, pressing out excess liquid with a spoon or paper towel — wet corn waters down the sauce and stops it from thickening.
In a small oven-safe skillet or cast iron pan, combine the corn, mayonnaise, sugar, salt, and butter over medium heat.
Stir constantly for 3 to 4 minutes, until the butter melts in and the mixture turns glossy and slightly thickened, coating each kernel.
Taste and adjust the sugar — canned corn varies a lot in sweetness between brands, so this step matters more than the recipe number does.
Smooth the corn mixture into an even layer in the pan and scatter the shredded mozzarella evenly over the top.
Slide the pan under the broiler for 2 to 3 minutes, watching closely, until the cheese is fully melted and browned in spots. Alternatively, cover the pan and cook over low heat on the stovetop for 4 to 5 minutes until the cheese melts through.
Remove from the heat, scatter scallion or parsley and a crack of black pepper over the top, and serve immediately, straight from the pan, with spoons for scooping.