Custom environments with multicolumn header

The easiest way to accomplish this is to pass the title as an argument:

\newenvironment{example}[1]
  {\begin{tabular}{|l|l|}
   \hline
   \multicolumn{2}{|c|}{#1} \\
  }
  {\\\hline \end{tabular}}

and calling it as

\begin{example}{Team sheet}
... the data ...
\end{example}

This better reflects the role of the objects, too.

Adding a frame can be done with the mdframed package.


You can save the contents in a savebox and use it inside multicolumn:

\documentclass{article}
\usepackage{array}
\newenvironment{example}{%
  \setbox0=\hbox\bgroup
 }{
  \egroup%
  \begin{tabular}{|l|l|}
  \hline
  \multicolumn{2}{|c|}{\box0}\\\hline
  \end{tabular}
 }

\begin{document}

\begin{example}
Team sheet
\end{example}

\end{document}

However You can also use the command \fbox.