At last it depends on your tables. In the following MWE I show you several possibility's. Please check which one is the best for you.
- In section 2 I used environment
landscape (package pdflscape), that used an separate page for the table,
- in section 3 I used command
\ctable (package ctable), that shows the table on an own page and
- in section 4 I used environment
adjustbox (package adjustbox), which does not use a separate page (see the options I used!).
You can see that there is no need to include the command \section into an environment as you did with \sidewaystable. The \section command is the marker for the header to change the content. A sidewaystable is a float, that means LaTeX is allowed to move it to the next page for example. In your case (\section inside sideways table) the section heading was also moved.
The documentation for the used packages can you read with texdoc package name on the console/terminal. For example texdoc ctable for package ctable.
The MWE:
\documentclass{scrbook}
\usepackage[automark, headsepline]{scrlayer-scrpage}
%\usepackage{rotating}% for sidewaystable
\usepackage{pdflscape}% for landscape
\usepackage{blindtext}% to create a dummy document/text
\usepackage{ctable} % table rotated on complete page
\usepackage{adjustbox}% no own page!
\usepackage{caption} % for \captionof{table}{text}
\begin{document}
\section{Section 1}
\Blindtext
\section{Section 2}
\Blindtext
\begin{landscape}
\captionof{table}{Test table section 2}
\begin{tabular}{lll}
Column 1/2 & Column 2 & Column 3 \\
Row 2, 1 & Row 2, 2 & Row 2, 3 \\
Row 3, 1 & Row 3, 2 & Row 3, 3
\end{tabular}
\end{landscape}
\Blindtext
\section{Section 3}
\ctable[%
caption={Test table section 3},
label={tab:testtable},
botcap, % caption below table
sideways % This rotates the table
]{ccc}
{
% Table footnotes here, see ctable docs
}
{
Column 1/3 & Column 2 & Column 3 \\
Row 2, 1 & Row 2, 2 & Row 2, 3 \\
Row 3, 1 & Row 3, 2 & Row 3, 3 \\
}
\blindtext
\section{Section 4}
\blindtext
\begin{adjustbox}{angle=90,center,caption={Test table section 4},nofloat=table}
\begin{tabular}{lll}
Column 1/4 & Column 2 & Column 3 \\
Row 2, 1 & Row 2, 2 & Row 2, 3 \\
Row 3, 1 & Row 3, 2 & Row 3, 3
\end{tabular}
\end{adjustbox}
\blindtext
\end{document}
See the result for section 4:

\sectioninsidesidewaystable(which is a float). You needlandscapeenvironment instead. – Oct 04 '15 at 02:11