In a bowl, mix together the fresh corn, mayonnaise, mozzarella, sugar, and green onions until everything is well combined. Season with salt and pepper to taste.
Spread the mixture into a lightly greased baking dish.
Bake in the oven for about 10 minutes, or until the cheese is melted and bubbly.
Switch to the broiler and broil for another 2 minutes, keeping an eye on it until the top is golden brown.