Answer: The Gemara (Berachos 38a) writes that one only recites a beracha on food that one eats for medical reasons if they will enjoy eating it. Likewise, the Shulchan Aruch (OC 204:7) writes that one only says a beracha before (and after) drinking water if they are doing so to quench their thirst. Thus, the Mishna Berura (204:42) writes that if one drank some water just to enable them to swallow a pill, they should not recite a beracha. However, if one drinks any other beverage, one would be required to recite a beracha.
R’ Moshe Feinstein (Igros Moshe OC 1:82) writes that if the medication itself tastes nice, then one should recite a beracha. Likewise, R’ Yosef Shalom Elyashiv (quoted in Rivevos Ephraim 4:54:39) maintained that if one mixed the medicine into something that tastes good, one would need to recite a beracha on it.
There is a machlokes as to whether one recites a beracha upon taking medicine that has flavouring added to make it taste sweet. According to R’ Yehoshua Neuwirth (Shemiras Shabbos Kehilchasa 40:n231) one does not recite a beracha as the main ingredient is bitter, though R’ Ovadia Yosef (Yalkut Yosef OC 204:10:n10) held that one should recite a beracha (See Nishmat Avraham OC 204:1). Similarly, R’ Shlomo Zalman Auerbach (quoted by R’ Avraham Avraham) held that one should recite a beracha on pills that are coated with sweeteners.
The Shulchan Aruch (OC 230:4) writes that one about to undergo a medical procedure should recite: יְהִי רָצוֹן מִלְּפָנֶיךָ ה' אֱלֹקַי שֶׁיִּהְיֶה לִי עֵסֶק זֶה לִרְפוּאָה כִּי רוֹפֵא חִנָּם אַתָּה, “May it be your will, Hashem, that this procedure should cure me, for You are a Doctor who does not charge,” and afterwards, בָּרוּךְ רוֹפֵא חוֹלִים, “Blessed is the One who heals the ill” (See Mishna Berura 230:6). R’ Avraham Avraham (ibid. 204:5; 230:1) quotes R’ Eliezer Waldenberg who says that one should say these tefillos before and after taking medication. This would serve in place of reciting a beracha, thus satisfying both views.
In conclusion, when the medicine tastes good (such as throat lozenges) one must say a beracha before taking. This would apply to a drink other than water that one takes to swallow pills. Before taking other medication, one should recite the yehi ratzon instead.