For the most competitive residencies, a top flight medical school may confer some advantage. However, this definitely FOLLOWS (as GP says above) your USMLE scores, grades, AOA, letters, etc.
Bottom line - choose a medical school which will provide you with the most enjoyment (ie, is it where you want to live, do you like the students, the faculty, the curriculum) and a good education rather than for the name. Doing well is the best weapon in your residency application arsenal.