Ahithophel counselled David and Absalom.
2 Samuel 16:1 - 23
ESV - 1 When David had passed a little beyond the summit, Ziba the servant of Mephibosheth met him, with a couple of donkeys saddled, bearing two hundred loaves of bread, a hundred bunches of raisins, a hundred of summer fruits, and a skin of wine. 2 And the king said to Ziba, "Why have you brought these?" Ziba answered, "The donkeys are for the king's household to ride on, the bread and summer fruit for the young men to eat, and the wine for those who faint in the wilderness to drink.
For follow-up discussion and general commentary on the topic. Comments are sorted chronologically.
Also, Bathsheba was Ahitophel's granddaughter, and though Scripture does not speak on the matter, we can speculate that this may have figured into his decision to throw his support to David.