You need to wrap your code in a $(document).ready
block, or else move it to the bottom of the page, since those checkboxes don't exist yet:
<script language="javascript">
$(document).ready(function() {
$("input:checkbox:not(:checked)").each(function () {
var column = "table ." + $(this).attr("name");
$(column).hide();
});
$("input:checkbox").click(function () {
var column = "table ." + $(this).attr("name");
$(column).toggle();
});
});
</script>
in jsFiddle, the second dropdown in the upper-left corner is usually set to "onLoad", which triggers this behavior automatically.