Set the relevant options:
\documentclass[12pt]{article}
\usepackage{algorithm2e}
\begin{document}
\begin{algorithm}
\SetAlgoCaptionSeparator{}% no separator, default colon
\SetAlCapNameSty{}% no caption text
\While{\dots}{
\dots
}
\caption{}
\end{algorithm}
\end{document}

If all your algorithms have no text in captions, you can place the two commands in the preamble:
\documentclass[12pt]{article}
\usepackage{algorithm2e}
\SetAlgoCaptionSeparator{}% no separator, default colon
\SetAlCapNameSty{}% no caption text
\begin{document}
\begin{algorithm}
\While{\dots}{
\dots
}
\caption{This text won't appear}
\end{algorithm}
\end{document}
If only some of the captions should be void, you can do
\documentclass[12pt]{article}
\usepackage{algorithm2e}
\newcommand{\voidcaption}[2][]{%
\SetAlgoCaptionSeparator{}% no separator, default colon
\SetAlCapNameSty{}% no caption text
\caption{}%
}
\begin{document}
\begin{algorithm}
\While{\dots}{
\dots
}
\voidcaption{This text won't appear}
\end{algorithm}
\end{document}
I'd not define \voidcaption
without arguments, so that it would be easy to go back and typeset the given text instead.