Code:
{if $main ne "anonymous_checkout" OR $main eq "checkout"}
{include file="customer/categories.tpl" }
{/if}
Should work with no problem.
If that is not working for you try
Code:
{if ($main ne "anonymous_checkout") OR ($main eq "checkout")}
{include file="customer/categories.tpl" }
{/if}