No. Will Ferrell does not appear in Sherlock Holmes (2009), directed by Guy Ritchie and starring Robert Downey Jr. (Holmes) and Jude Law (Watson).
Ferrell starred in the 2018 comedy Holmes & Watson (with John C. Reilly as Watson)—a parody often confused with the Ritchie films.