The default fancy
pagestyle of fancyhdr
already automatically puts the section title in the header. MWE:
\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lipsum}
\begin{document}
\section{First section}
\lipsum[1-10]
\section{Second section}
\lipsum[1-10]
\end{document}

If you don't want the number to be printed, you can redefine the \sectionmark
command to only a left mark (which is printed on the top right of the page) containing the section title, and an empty rightmark (on the left of the page), which is more or less what you tried with the \rhead
command if I understand correctly.
This redefinition is done in the preamble (before \begin{document}
) and affects the entire document, so you have to set it only once and you don't need to repeat it for every section. MWE:
\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
\usepackage{lipsum}
\begin{document}
\section{First section}
\lipsum[1-10]
\section{Second section}
\lipsum[1-10]
\end{document}
Result:

If you don't like the italic font then you can set the \rhead
, again globally in the preamble, to contain the \leftmark
(which defaults to the section title in most documentclasses without chapters). You can format it to be upper case, smallcaps, bold, or any other style you prefer, or just plain roman as in the following MWE:
\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
\rhead{\leftmark}
\usepackage{lipsum}
\begin{document}
\section{First section}
\lipsum[1-10]
\section{Second section}
\lipsum[1-10]
\end{document}
Result:
