Preheat the oven to 350 degrees F (175 degrees C). Grease a 9x13-inch baking pan.
Melt butter in a large skillet over medium heat. Add onion, bell pepper, and pimento peppers; sauté until tender, about 5 minutes.
Combine corn muffin mix, green chiles, whole corn, creamed corn, and eggs in a large bowl; stir in onion mixture.
Pour into the prepared baking pan.
Spread sour cream evenly over the mixture; sprinkle with Cheddar cheese.
Bake in the preheated oven until casserole is lightly browned and firm, about 45 minutes.
