Omitting any salt or fat, cook the beans according to the package directions. Drain, and set aside.
In a medium saucepan over low heat, melt the margarine and then add the flour, stirring until smooth. Stirring constantly, continue to cook for one minute. Gradually add the milk and cook on medium heat until thickened, constantly stirring. Stir in the salt and the pepper and then remove from the heat.
Preheat your oven to 375 degrees F and then add the beans, pimiento, cheese, and ketchup to the sauce. Stir well, and then spoon into a 1 1/2-quart casserole dish that has been treated with cooking spray.