Carefully slice the kernels off the 2 ears of corn and transfer them to a food processor or blender to create a “creamy corn”.
To skip this step, you can use creamy corn. But fresh is better.
Grab a big pot and, over low heat, start melting the butter. Add the onions and cook until translucent. About 4 minutes. Then add the frozen corn to the pot.
The heat needs to be low because the butter and onions can burn easily.
Pour in the milk and butter, and add the creamy corn that you made in the blender.
Season with salt and pepper, mix, and cook for 5 minutes. Cover with a lid.
Add the corn mix (or the homemade mix made before) and stir until everything is uniform.
Make sure the corn mixture has cooled down. Crack and whisk the eggs in a separate bowl before adding them. Pour the eggs into the corn mixture and mix well.
This helps them mix better and ensures a spoiled egg won't ruin the entire dish.
Add cream cheese and the extra 30g of butter if needed.
Add the cream cheese while the mixture is hot so it's easier to mix.
Cooking
Preheat the oven to 350°F (175°C)
Grease a tray with cooking spray and pour the mixture into the baking dish.
If you want, sprinkle raw bacon on top before cooking. Bake for 35 minutes.
Cooking time depends on the oven.
Five minutes before it's done, remove the casserole from the oven and top evenly with shredded cheese. Return it to the oven under the broiler (or grill) for the last 5 minutes. Let it rest for 10 minutes before serving.
If your oven doesn't have a broiler: Move the oven rack down one level and slightly increase the temperature until the cheese is melted and golden brown.
Notes
Storage, Reheating & Make Ahead
Planning ahead makes holiday cooking so much easier, and this dish handles prep and leftovers really well
Make Ahead: You can assemble the entire mixture up to a day in advance. Pour the cooled base into your greased baking dish, cover it tightly with foil, and keep it in the refrigerator for up to 24 hours. Let the pan sit on the counter at room temperature for 30 minutes before it goes into the oven so the center bakes evenly, then top with the cheese at the end as usual.
Fridge Storage: Let leftovers cool down completely, then transfer slices to an airtight container (or wrap the baking pan tightly). It stays fresh in the fridge for up to 4 days.
Freezer: I only recommend freezing this baked corn casserole after it has been cooked, since freezing the raw cream cheese base can make the dairy separate when you thaw it. Wrap cooled portions tightly in plastic wrap and a layer of foil, and freeze for up to 2 months. Let it thaw overnight in the fridge before warming it up.
Reheating: For a single slice, pop it in the microwave for 45 to 60 seconds with a damp paper towel over the top so it keeps its moisture. If you are warming up a larger batch, cover the pan with foil and bake at 350°F (175°C) for 15 to 20 minutes until heated through.
When you slice the fresh corn off the cob for the blender, flip your knife upside down and scrape the dull back edge of the blade down the bare cob. That pulls out all the sweet "corn milk" trapped inside the cob, giving your blended cream base twice the fresh corn flavor without adding extra liquid!