\documentclass{scrbook}

\usepackage{xspace}
\usepackage{mfirstuc}

\newcommand{\MyCommandbase}{text to capitalise}
\newcommand{\MyCommand}{\xcapitalisewords{\MyCommandbase}\xspace}

\begin{document}

\chapter{First Chapter}
\MyCommand.

\section{\MyCommand}
\section{Test}
\MyCommand.

\subsection{\MyCommand}
\subsection{Test}
\MyCommand.

\chapter{\MyCommand}
\chapter{Test}
\MyCommand.

\end{document}